﻿using Dapper;
using System;
using BCEntity.TMS.VehicleBusinessMapping;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;
using BCCommon.TMS.Transport;

namespace BCData.TMS.VehicleBusinessMapping
{
	/// <summary>
	/// 车辆与业务配置重写
	/// </summary>
	public interface IVehicleBusinessMappingOverwriteData
	{
		#region  成员方法
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		/// <param name="vehicleBusinessMappingOverwriteId">车辆与业务配置重写Id</param>
		Task<bool> Exists(int vehicleBusinessMappingOverwriteId);
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		/// <param name="agentRecordId">代理商Id</param>
		/// <param name="countyCode">区县编码</param>
		/// <param name="vehicleBusinessMappingId">车辆与业务配置Id</param>
		Task<bool> Exists(long agentRecordId,string countyCode, int vehicleBusinessMappingId );
		/// <summary>
		/// 是否存在已使用的该记录
		/// </summary>
		/// <param name="vehicleBusinessMappingId">车辆与业务配置Id</param>
		Task<bool> InUsed(int vehicleBusinessMappingId);
		/// <summary>
		/// 增加车辆与业务配置重写
		/// </summary>
		/// <param name="entity">车辆与业务配置重写信息</param>
		Task<VehicleBusinessMappingEntity> Add(VehicleBusinessMappingEntity entity);
		/// <summary>
		/// 更新车辆与业务配置重写
		/// </summary>
		/// <param name="entity">车辆与业务配置重写信息</param>
		Task<VehicleBusinessMappingEntity> Update(VehicleBusinessMappingEntity entity);
		/// <summary>
		/// 删除车辆与业务配置重写
		/// </summary>
		/// <param name="vehicleBusinessMappingOverwriteId">车辆与业务配置重写Id</param>
		Task<bool> Delete(int vehicleBusinessMappingOverwriteId);
		/// <summary>
		/// 获取车辆与业务配置重写
		/// </summary>
		/// <param name="vehicleBusinessMappingOverwriteId">车辆与业务配置重写Id</param>
		Task<VehicleBusinessMappingEntity> GetEntity(int vehicleBusinessMappingOverwriteId);
		/// <summary>
		/// 获取车辆与业务配置重写
		/// </summary>
		/// <param name="vehicleBusinessMappingId">车辆与业务配置Id</param>
		/// <param name="agentRecordId">代理商Id</param>
		Task<VehicleBusinessMappingEntity> GetEntity(int vehicleBusinessMappingId, long agentRecordId);

		/// <summary>
		/// 获取车辆与业务配置重写
		/// </summary>
		/// <param name="transportBusinessType">运输业务类型</param>
		/// <param name="vehicleTypeId">车型Id</param>
		/// <param name="vehicleCategoryReferenceId">车辆分来Id</param>
		/// <param name="agentRecordId">代理商Id</param>
		/// <returns></returns>
		Task<VehicleBusinessMappingEntity> GetEntity(TransportBusinessType transportBusinessType, int vehicleTypeId, int? vehicleCategoryReferenceId, long agentRecordId);
		/// <summary>
		/// 获取车辆与业务配置重写列表
		/// </summary>
		/// <param name="agentRecordId">代理商Id</param>
		Task<IEnumerable<VehicleBusinessMappingEntity>> GetList(long agentRecordId);
		/// <summary>
		/// 获取车辆与业务配置重写列表
		/// </summary>
		/// <param name="countyCode">区县编码</param>
		/// <returns></returns>
		Task<IEnumerable<VehicleBusinessMappingEntity>> GetList(string countyCode);

		/// <summary>
		/// 获取车辆与业务配置分页列表
		/// </summary>
		/// <param name="agentRecordId">代理商Id</param>
		/// <param name="provinceCode">省份编码</param>
		/// <param name="cityCode">城市编码</param>
		/// <param name="countyCode">区县编码</param>
		/// <param name="vehicleTransportBusinessConfigId">车辆运输业务配置Id</param>
		/// <param name="vehicleTypeId">车型Id</param>
		/// <param name="enabled">启用</param>
		/// <param name="start">开始时间</param>
		/// <param name="end">结束时间</param>
		/// <param name="sortName">排序字段</param>
		/// <param name="ascending">升序</param>
		/// <param name="pageIndex">当前页码</param>
		/// <param name="pageSize">每页数据条数</param>
		Task<(IEnumerable<VehicleBusinessMappingEntity>, int)> Query(long? agentRecordId, string provinceCode,string cityCode, string countyCode, int? vehicleTransportBusinessConfigId,int? vehicleTypeId, bool? enabled, DateTime? start, DateTime? end, string sortName, bool? ascending, int pageIndex, int pageSize);
		/// <summary>
		/// 启用车辆与业务配置重写
		/// </summary>
		/// <param name="vehicleBusinessMappingOverwriteId">车辆与业务配置重写Id</param>
		/// <param name="adminId">员工Id</param>
		/// <param name="fullname">员工姓名</param>
		Task<bool> Enabled(int vehicleBusinessMappingOverwriteId, long adminId, string fullname);
		/// <summary>
		/// 禁用车辆与业务配置重写
		/// </summary>
		/// <param name="vehicleBusinessMappingOverwriteId">车辆与业务配置重写Id</param>
		/// <param name="adminId">员工Id</param>
		/// <param name="fullname">员工姓名</param>
		Task<bool> Disabled(int vehicleBusinessMappingOverwriteId, long adminId, string fullname);
		#endregion  成员方法

		#region 扩展方法
		/// <summary>
		/// 获取司机端车辆列表
		/// </summary>
		/// <param name="countyCode">区县编码</param>
		/// <returns></returns>
		Task<IEnumerable<VehicleBusinessMappingForAppEntity>> GetListForApp(string countyCode);
		#endregion

		/// <summary>
		/// 获取车辆与业务配置
		/// </summary>
		/// <param name="agentRecordId">代理商ID</param>
		/// <param name="countyCode">区县编码</param>
		/// <param name="vehicleTransportBusinessConfigId">车辆运输业务配置Id</param>
		/// <returns></returns>
		Task<IEnumerable<VehicleBusinessMappingEntity>> GetList(long? agentRecordId, string countyCode, int vehicleTransportBusinessConfigId);
	}


}